<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="个人博客">
    <meta name="keyword"  content="">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>
        
        树莓派查询声音设备地址 - undefined
        
    </title>

    <!-- Custom CSS -->
    <link rel="stylesheet" href="/css/aircloud.css">
    <link rel="stylesheet" href="/css/gitment.css">
    <!--<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">-->
    <link href="//at.alicdn.com/t/font_620856_pl6z7sid89qkt9.css" rel="stylesheet" type="text/css">
    <!-- ga & ba script hoook -->
    <script></script>
</head>

<body>

<div class="site-nav-toggle" id="site-nav-toggle">
    <button>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
    </button>
</div>

<div class="index-about">
    <i>  </i>
</div>

<div class="index-container">
    
    <div class="index-left">
        
<div class="nav" id="nav">
    <div class="avatar-name">
        <div class="avatar ">
            <img src="/" />
        </div>
        <div class="name">
            <i>loong</i>
        </div>
    </div>
    <div class="contents" id="nav-content">
        <ul>
            <li >
                <a href="/">
                    <i class="iconfont icon-shouye1"></i>
                    <span>主页</span>
                </a>
            </li>
            <li >
                <a href="/tags">
                    <i class="iconfont icon-biaoqian1"></i>
                    <span>标签</span>
                </a>
            </li>
            <li >
                <a href="/archives">
                    <i class="iconfont icon-guidang2"></i>
                    <span>存档</span>
                </a>
            </li>
            <li >
                <a href="/about/">
                    <i class="iconfont icon-guanyu2"></i>
                    <span>关于</span>
                </a>
            </li>
            
        </ul>
    </div>
    
        <div id="toc" class="toc-article">
    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#树莓派查询声音设备地址"><span class="toc-text">树莓派查询声音设备地址</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-查看-proc-asound-cards文件内容"><span class="toc-text">1.    查看/proc/asound/cards文件内容</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-未插入声音设备前"><span class="toc-text">1.    未插入声音设备前</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-插入声音设备后"><span class="toc-text">2.    插入声音设备后</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-使用ALSA库命令查看设备信息"><span class="toc-text">2.    使用ALSA库命令查看设备信息</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-查看录音设备"><span class="toc-text">1.    查看录音设备</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-查看播放设备"><span class="toc-text">2.    查看播放设备</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-赠品"><span class="toc-text">3.赠品</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-参数"><span class="toc-text">1.    参数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-区别"><span class="toc-text">2.    区别</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-参考链接"><span class="toc-text">4.    参考链接</span></a></li></ol></li></ol>
</div>
    
</div>


<div class="search-field" id="search-field">
    <div class="search-container">
        <div class="search-input">
            <span id="esc-search"> <i class="icon-fanhui iconfont"></i></span>
            <input id="search-input"/>
            <span id="begin-search">搜索</span>
        </div>
        <div class="search-result-container" id="search-result-container">

        </div>
    </div>
</div>

        <div class="index-about-mobile">
            <i>  </i>
        </div>
    </div>
    
    <div class="index-middle">
        <!-- Main Content -->
        


<div class="post-container">
    <div class="post-title">
        树莓派查询声音设备地址
    </div>

    <div class="post-meta">
        <span class="attr">发布于：<span>2019-11-09 17:09:10</span></span>
        
        </span>
        <span class="attr">访问：<span id="busuanzi_value_page_pv"></span>
</span>
</span>
    </div>
    <div class="post-content ">
        <h1 id="树莓派查询声音设备地址"><a href="#树莓派查询声音设备地址" class="headerlink" title="树莓派查询声音设备地址"></a>树莓派查询声音设备地址</h1><h2 id="1-查看-proc-asound-cards文件内容"><a href="#1-查看-proc-asound-cards文件内容" class="headerlink" title="1.    查看/proc/asound/cards文件内容"></a>1.    查看/proc/asound/cards文件内容</h2><h3 id="1-未插入声音设备前"><a href="#1-未插入声音设备前" class="headerlink" title="1.    未插入声音设备前"></a>1.    未插入声音设备前</h3><p>此时的显示的设备是树莓派缺省音频设备bcm2835 ALSA。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$:cat /proc/asound/cards</span><br><span class="line">0 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA</span><br><span class="line">                     bcm2835 ALSA</span><br></pre></td></tr></table></figure>

<h3 id="2-插入声音设备后"><a href="#2-插入声音设备后" class="headerlink" title="2.    插入声音设备后"></a>2.    插入声音设备后</h3><p>连接USB声卡后，可以看到USB音频设备USB Audio Device</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">$:cat /proc/asound/cards</span><br><span class="line">0 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA</span><br><span class="line">                     bcm2835 ALSA</span><br><span class="line">1 [U0x46d0x825    ]: USB-Audio - USB Device 0x46d:0x825</span><br><span class="line">                     USB Device 0x46d:0x825 at usb-3f980000.usb-1.1.2, high speed</span><br></pre></td></tr></table></figure>

<h2 id="2-使用ALSA库命令查看设备信息"><a href="#2-使用ALSA库命令查看设备信息" class="headerlink" title="2.    使用ALSA库命令查看设备信息"></a>2.    使用ALSA库命令查看设备信息</h2><h3 id="1-查看录音设备"><a href="#1-查看录音设备" class="headerlink" title="1.    查看录音设备"></a>1.    查看录音设备</h3><p>可以看到树莓派上所有的可供录音的设备。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">$:arecord -l</span><br><span class="line">**** List of CAPTURE Hardware Devices ****</span><br><span class="line">card 1: U0x46d0x825 [USB Device 0x46d:0x825], device 0: USB Audio [USB Audio]</span><br><span class="line">  Subdevices: 1/1</span><br><span class="line">  Subdevice #0: subdevice #0</span><br></pre></td></tr></table></figure>

<h3 id="2-查看播放设备"><a href="#2-查看播放设备" class="headerlink" title="2.    查看播放设备"></a>2.    查看播放设备</h3><p>可以看到在插入USB设备时的所有的可播放设备，说明我使用Logitech C270是无法播放声音的，只能录音。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">$:aplay -l</span><br><span class="line">**** List of PLAYBACK Hardware Devices ****</span><br><span class="line">card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]</span><br><span class="line">  Subdevices: 7/7</span><br><span class="line">  Subdevice #0: subdevice #0</span><br><span class="line">  Subdevice #1: subdevice #1</span><br><span class="line">  Subdevice #2: subdevice #2</span><br><span class="line">  Subdevice #3: subdevice #3</span><br><span class="line">  Subdevice #4: subdevice #4</span><br><span class="line">  Subdevice #5: subdevice #5</span><br><span class="line">  Subdevice #6: subdevice #6</span><br><span class="line">card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]</span><br><span class="line">  Subdevices: 1/1</span><br><span class="line">  Subdevice #0: subdevice #0</span><br></pre></td></tr></table></figure>



<h2 id="3-赠品"><a href="#3-赠品" class="headerlink" title="3.赠品"></a>3.赠品</h2><p>附带一个<strong>plughw</strong>和<strong>hw</strong>的区别和参数介绍吧</p>
<h3 id="1-参数"><a href="#1-参数" class="headerlink" title="1.    参数"></a>1.    参数</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">plughw:0,0或hw:0,0</span><br><span class="line">第一个数字是声卡的编号,第二个数字是设备的编号</span><br></pre></td></tr></table></figure>



<h3 id="2-区别"><a href="#2-区别" class="headerlink" title="2.    区别"></a>2.    区别</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hw: accesses the hardware device directly. // 直接访问硬件</span><br><span class="line">plughw: inserts sample rate and format conversion plugins, if needed. //经过采样率和格式转换插件。</span><br></pre></td></tr></table></figure>



<p>可以得出我的C270设备的地址号为<strong>U0x46d0x825</strong>。</p>
<h2 id="4-参考链接"><a href="#4-参考链接" class="headerlink" title="4.    参考链接"></a>4.    参考链接</h2><ol>
<li><a href="https://blog.csdn.net/z2066411585/article/details/99089141" target="_blank" rel="noopener">plughw和hw的区别</a></li>
<li><a href="http://blog.sina.com.cn/s/blog_55c3a5ae0102wqku.html" target="_blank" rel="noopener">查看相关文件查看硬件地址</a></li>
<li><a href="http://blog.sina.com.cn/s/blog_55c3a5ae0102wqku.html" target="_blank" rel="noopener">使用ALSA命令查看硬件地址</a></li>
<li><a href="https://users.suse.com/~mana/alsa090_howto.html" target="_blank" rel="noopener">ALSA编程指南</a></li>
</ol>

        
        <br />
        <div id="comment-container">
        </div>
        <div id="disqus_thread"></div>

        <div id="lv-container">
        </div>

    </div>
</div>

    </div>
</div>


<footer class="footer">
    <ul class="list-inline text-center">
        
        

        

        

        

        

    </ul>
    
    <p>
        <span id="busuanzi_container_site_pv">
            <span id="busuanzi_value_site_pv"></span>PV
        </span>
        <span id="busuanzi_container_site_uv">
            <span id="busuanzi_value_site_uv"></span>UV
        </span>
        Created By <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>  Theme <a href="https://github.com/aircloud/hexo-theme-aircloud" target="_blank" rel="noopener">AirCloud</a></p>
</footer>




</body>

<script>
    // We expose some of the variables needed by the front end
    window.hexo_search_path = ""
    window.hexo_root = "/"
    window.isPost = true
</script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="/js/index.js"></script>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




</html>
